package ipt.capitulo19;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.html.*;
import javax.swing.JEditorPane.*;
import java.net.URL;
public class ExploradorHTML{
	JEditorPane jeditorpane=new JEditorPane();
	JFrame marco;
	BarraBotones2 barraBotones;
	JTextArea htmlTexto;
	JEditorPane htmlAcercaDe;
	VigilaEnlaces vigilaE;
	JTabbedPane carpeta;
	LeeFicheroURL lF; 
	ExploradorHTML(){
		JFrame.setDefaultLookAndFeelDecorated(true);
		marco= new JFrame("Explorador HTML");
		marco.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		marco.setLayout(new BorderLayout()); 
		marco.setSize(500,500);
		carpeta=new JTabbedPane(JTabbedPane.TOP);
		barraBotones= new BarraBotones2(this);
		vigilaE=new VigilaEnlaces(this);
		marco.add(barraBotones,"North");
		jeditorpane.setEditable(false); 
		JScrollPane editorScrollPane = new JScrollPane(jeditorpane);
		marco.setIconImage(Toolkit.getDefaultToolkit().
							createImage("Tierra.gif"));
		editorScrollPane.setVerticalScrollBarPolicy(
							JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
		editorScrollPane.setPreferredSize(new Dimension(250, 145));
		editorScrollPane.setMinimumSize(new Dimension(10, 10));
		jeditorpane.addHyperlinkListener(vigilaE);
		lF=new LeeFicheroURL();
		marco.add(barraBotones,"North");
		marco.add(carpeta,"Center");
		carpeta.addTab("HTML", editorScrollPane); 
		htmlTexto=new JTextArea();
		htmlAcercaDe=new JEditorPane();
		JScrollPane jS=new JScrollPane(htmlTexto);
		carpeta.addTab("Texto",jS); 
		carpeta.addTab("Acerca de",htmlAcercaDe); 
		try{
			htmlAcercaDe.setPage(new URL("file:AcercaDe.html")); 
		}catch(Exception e){
			System.out.println("error en la URL file:AcercaDe.html");
		}
		marco.setVisible(true);
		marco.pack();
	}
	public static void main(String args[]){
		ExploradorHTML e1=new ExploradorHTML();
	}
}
